package cn.tradewin.advisor.pages.master;

import java.util.List;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.BeanModelSource;

import cn.tradewin.advisor.persist.model.Task;
import cn.tradewin.advisor.persist.services.MTaskService;

public class TaskBoard {
	@Inject
	private BeanModelSource beanModelSource;
	
	@Property
	private BeanModel<Task> beanModel;

	@Inject
	private MTaskService taskService;

	@Property
	private List<Task> tasks;

	@Property
	private Task task;

	@Inject
	private Messages messages;

	void setupRender() {
		beanModel = beanModelSource.createDisplayModel(Task.class, messages);
		beanModel.add("action", null);
		beanModel.include("taskName", "taskDesc","action");
		beanModel.get("taskName").sortable(false);
		beanModel.get("taskDesc").sortable(false);
		beanModel.get("action").sortable(false);
	}
	
	void onPrepareForRender() {
		this.tasks = taskService.getAllTasks();
	}
}
